#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
#include <errno.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "gps.h"

 
int gprmc_analysis (char *buff,GPRMC *gprmc)
{
char *ptr = NULL;

	if(gprmc == NULL)
        return -1;
    
	if(strlen(buff) < 10)
        return -1;

    if(NULL == (ptr = strstr(buff,"$GPRMC")))
        return -1;

	sscanf(ptr,"$GPRMC,%d.000,%c,%f,N,%f,E,%f,%f,%d,,,%c*",\
            &(gprmc->time),&(gprmc->pos_state),&(gprmc->latitude),\
			&(gprmc->latitude),&(gprmc->speed),&(gprmc->direction),\
			&(gprmc->date),&(gprmc->mode));
			
	return 0;

} /*  ----- End of gprmc_analysis()  ----- */